﻿//*** Guidance generated code ***//
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;

using ProjectBase.Core;

using Survey.Entity;

namespace Survey.Common.Business
{
    /// <summary>
    ///     Base Facade for all CodeList, expecting the class with public constructor
    /// </summary>
    /// <typeparam name = "T"></typeparam>
    /// <typeparam name = "TFilter"></typeparam>
    //[ContractClass(typeof(Diagnostics.CodeListFacade<,>))]
    public interface ICodeListFacade<T, TFilter> : IBaseFacade<T, int, TFilter>
        where T : class, ICodeList, new()
        where TFilter : class, IFilter<int>
    {
        /// <summary>
        ///     Returns new ICodeList enity of type 'T'
        ///     with rovided code. Name is set to string.Empty and IsVisible to true
        /// </summary>
        /// <param name = "code">not null nor empty code string</param>
        /// <returns></returns>
        T CreateNew(string code);

        /// <summary>
        ///     Returns new ICodeList enity of type 'T'
        ///     with rovided code and name. IsVisible is set to true
        /// </summary>
        /// <param name = "code">not null nor empty code string</param>
        /// <param name = "name">not mepty  name string</param>
        /// <returns></returns>
        T CreateNew(string code, string name);

        /// <summary>
        ///     Returns new ICodeList enity of type 'T'
        ///     with rovided code, name and isVisible
        /// </summary>
        /// <param name = "code">not null nor empty code string</param>
        /// <param name = "name">not mepty name string</param>
        /// <param name = "isVisible"></param>
        /// <returns></returns>
        T CreateNew(string code, string name, bool isVisible);

        /// <summary>
        ///     Provides the list of all CodeList values (IsVisible is NOT evaluated)
        /// </summary>
        /// <returns></returns>
        IEnumerable<T> GetAll();

        /// <summary>
        ///     Provides the list of all CodeList values with IsVisible == true
        /// </summary>
        /// <returns></returns>
        IEnumerable<T> GetAllVisible();

        /// <summary>
        ///     Returns one 'T' CodeList Value by provided code.
        ///     If nothing is found - null is returned.
        ///     If more then one record exists, exception is thrown
        /// </summary>
        /// <param name = "code"></param>
        /// <returns></returns>
        T GetByCode(String code);
    }
}